Skip to content

Conversation

@gonfunko
Copy link
Contributor

This PR fixes #297 by moving the Enter action into its own class, and moving several helper functions used only by that action into its class and out of navigation.ts. This also incorporates changes from #273 in insertFromFlyout(), which was moved into the enter action class.

@gonfunko gonfunko requested a review from a team as a code owner March 10, 2025 20:54
@gonfunko gonfunko requested review from rachel-fenichel and removed request for a team March 10, 2025 20:54
Copy link
Collaborator

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am about to add another meaning for the enter key: when moving a block, pressing enter will place the block at its current location. I was going to just wire it in to handleEnterForWS but as this PR is now in-flight it occured to me that a better approach is to do what we should eventually do anyway, and make it a completely separate action. Similarly, I think the several unrelated activities here should be split in to separate actions:

  1. One which, when on a flyout button, presses the button.
  2. One which, when on a flyout stack, creates new block(s) on the workspace.
  3. One which, when on a field, opens the field editor.
  4. One which, when on a connection or the workspace, runs the insert action (this should be in insert.ts)
  5. One which, when none of the above apply, shows the help message about the context menu.
    • This needs to be registered first, since shortcuts are tried in the reverse of the order they are registered in.

It might be reasonable for 1 and 2 to be kept as part of a single action, but the other three are unrelated and ought to be separated out. (No objection to doing this as part of a separate follow-up PR, or even just filing a bug to do it later.)

@rachel-fenichel
Copy link
Collaborator

Let's still merge this PR, and land your new meaning of Enter, and then assess. I am leery of splitting this into multiple actions because it spreads out the logic for deciding which action to do/which takes prioritiy.

@gonfunko gonfunko merged commit 6ad95c0 into main Mar 12, 2025
1 check passed
@gonfunko gonfunko deleted the enter-action branch March 12, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move enter action and helpers to a new file

4 participants